﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CanDoo.Core.Data;
using CanDoo.Data;
using CanDoo.Admin.Core.Models;

namespace CanDoo.Oil.Core.Models
{
    /// <summary>
    /// 实体类——API操作日志
    /// </summary>
    [Serializable]
    [Description("API操作日志")]
    public class APIOperateLog :  EntityBase,ICreatedTime, IAudited
    {
        /// <summary>
        ///售油机编号
        /// </summary>
        [Display(Name = "售油机编号")]
        [Required, StringLength(50)]
        public string OilSalerNo { get; set; }

        /// <summary>
        ///售油机
        /// </summary>
        [Display(Name = "售油机")]
        public virtual OilSalesSerialNum OilSalesSerialNum { get; set; }
        /// <summary>
        ///售油机外键
        /// </summary>
        [Display(Name = "售油机外键")]
        public long OilSalesSerialNumId { get; set; }

        /// <summary>
        ///通道号
        /// </summary>
        [Display(Name = "通道号")]
        public int OilPort { get; set; }

        /// <summary>
        ///关联哪桶油
        /// </summary>
        [Display(Name = "关联哪桶油")]
        public virtual OilSerialNum OilSerialNum { get; set; }
        /// <summary>
        ///关联哪桶油外键
        /// </summary>
        [Display(Name = "关联哪桶油外键")]
        public long? OilSerialNumId { get; set; }

        /// <summary>
        ///批次号
        /// </summary>
        [Display(Name = "批次号")]
        [StringLength(50)]
        public string BatchNo { get; set; }

        /// <summary>
        ///操作时间
        /// </summary>
        [Display(Name = "操作时间")]
        [Required]
        public DateTime? OpreateTime { get; set; }

        /// <summary>
        ///操作类型 1设备绑定 2获取售油配置信息 3取油码取油 4取油码取油状态上报 5本店活动 6门店介绍 7会员刷卡取油 8会员刷卡取油状态上报 9管理员登录 10换油桶请求 11更换油桶状态上报 12清洗操作记录查询 13清洗操作记录上传 14管理员调试出油记录上传 15状态上报 16媒体门店登录 17查询媒体列表
        /// </summary>
        [Display(Name = "操作类型")]
        [Required]
        public int OperateType { get; set; }

        /// <summary>
        ///出油量
        /// </summary>
        [Display(Name = "出油量")]
        [Required]
        public double OilOutPut { get; set; }

        /// <summary>
        ///操作前油量
        /// </summary>
        [Display(Name = "操作前油量")]
        [Required]
        public double Before { get; set; }

        /// <summary>
        ///剩余油量
        /// </summary>
        [Display(Name = "剩余油量")]
        [Required]
        public double Last { get; set; }

        /// <summary>
        ///单价
        /// </summary>
        [Display(Name = "单价")]
        [Required]
        public double Price { get; set; }

        /// <summary>
        ///金额
        /// </summary>
        [Display(Name = "金额")]
        [Required]
        public double Money { get; set; }

        /// <summary>
        ///客户消费金额 如果是取油码的话就代表用掉的油
        /// </summary>
        [Display(Name = "客户消费金额")]
        public double CustomMoney { get; set; }

        /// <summary>
        ///客户原有金额 如果是取油码的话就代表原来的油
        /// </summary>
        [Display(Name = "客户原有金额")]
        public double CustomMoneyBefore { get; set; }

        /// <summary>
        ///客户剩余金额   如果是取油码的话就代表剩余的油
        /// </summary>
        [Display(Name = "客户剩余金额")]
        public double CustomMoneyLast { get; set; }


        /// <summary>
        ///上报时间
        /// </summary>
        [Display(Name = "上报时间")]
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        ///操作员
        /// </summary>
        [Display(Name = "操作员")]
        [Required, StringLength(50)]
        public string Operater { get; set; }

        /// <summary>
        ///token
        /// </summary>
        [Display(Name = "token")]
        [StringLength(50)]
        public string Token { get; set; }

        /// <summary>
        ///关联ID 主要用于取油码取油
        /// </summary>
        [Display(Name = "关联ID")]
        public long? LinkEntityId { get; set; }

        /// <summary>
        ///客户
        /// </summary>
        [Display(Name = "客户")]
        public virtual Customer Customer { get; set; }

        /// <summary>
        ///客户
        /// </summary>
        [Display(Name = "客户外键")]
        public long? CustomerId { get; set; }

        /// <summary>
        ///操作结果 1成功 2失败
        /// </summary>
        [Display(Name = "操作结果")]
        public int Status { get; set; }

        /// <summary>
        ///挡板状态
        /// </summary>
        [Display(Name = "挡板状态")]
        public int OilState { get; set; }

        /// <summary>
        ///出油状态
        /// </summary>
        [Display(Name = "出油状态")]
        public int BaffleState { get; set; }


        /// <summary>
        ///门状态
        /// </summary>
        [Display(Name = "门状态")]
        public int DoorState { get; set; }


        /// <summary>
        ///管路状态
        /// </summary>
        [Display(Name = "管路状态")]
        public int PipingState { get; set; }

        #region Implementation of ICreatedTime

        /// <summary>
        /// 获取设置 信息创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #region Implementation of ICreatedAudited

        /// <summary>
        /// 获取或设置 创建者编号
        /// </summary>
        [Display(Name = "创建人")]
        public string CreatorUserId { get; set; }

        #endregion

        #region Implementation of IUpdateAutited

        /// <summary>
        /// 获取或设置 最后更新时间
        /// </summary>
        [Display(Name = "最后更新时间")]
        public DateTime? LastUpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 最后更新者编号
        /// </summary>
        [Display(Name = "最后更新用户")]
        public string LastUpdatorUserId { get; set; }

        #endregion
    }
}
